package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("note.txt",true);
        Scanner sc = new Scanner(System.in);
        String a = "exit";


        System.out.println("请输入");
        while(true){
            String str = sc.next();
            byte[] data = str.getBytes(StandardCharsets.UTF_8);
            if(!str.equals(a)){
                fos.write(data);
                fos.write('\n');//换行，转义字符
                System.out.println("继续输入");
          }else{
                System.out.println("再见");
                fos.close();
                break;
            }

        }

    }
}
